<{*卡券列表*}>
<{include file="top_v2.html" }>
<style>
    .ygq,.ysy{ background-size: 25% !important;background-repeat: no-repeat !important;background-position:right bottom }
    .ygq{background-image:url(./Public/Wap/v2/img/ygq.png)}
    .ysy{background-image:url(./Public/Wap/v2/img/ysy.png)}
</style>
</head>
<body>
<div id="wrap" class="pt pb coupon-page">
    <div class="header">
        卡券
        <a href="javascript:window.history.back();" class="back"></a>
    </div>

    <div class="container">
        <{if $list}>
        <ul>
            <{include file="Card_v2/item.html" }>
        </ul>
        <{else}>
        <div class="empty">
            <img src="img/empty-2.png" alt="" />
            <p>您还没有任何卡券</p>
        </div>
        <{/if}>
    </div>
    <div class="footer">
        <a href="<{U('history')}>" class="history">查看历史卡券<i></i></a>
    </div>
</div>




</body>
</html>
<script>

    var $list = $("#theList");
    var $listParent = $list.parent();
    var isLoading = false;
    var page = 2;
    function  load_more(postData){
        if(isLoading) return;
        isLoading = true;
        if(postData == null){
            postData = {page:page,pos:"cardListMore"};
        }
        $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
        $("#load_more  span").html('正在加载...');
        $.post("<{u('cardListMore')}>",postData  ,  function(data){
            isLoading = false;
            if(data.data) {
                $(".append-html").append(data.data);
                $("#load_more  span").html('加载更多');
                page++;
                $("#load_more").css({'background':'url("<{$preStaticUrl}>Wap/images/load.gif")  center  center  no-repeat;background-size:30px  30px;'});
            } else {
                $("#load_container").html('<a  href="javascript:;"  id="load_more"><span>没有更多卡券啦</span></a>');
                $("#load_more").css({'background':'url("")'}).css({'padding-top':'0'}).css({'top':'0px'}).css({'position':'relative'});
            }
        },'json');
    }
    var  tmp_scroll  =  0;
    //拖动加载
    function  scroll_load(postData){
        if  (tmp_scroll == $(window).height() + $(window).scrollTop()){return;}
        tmp_scroll  =  $(window).height() + $(window).scrollTop();
        var  jia_scroll  =  $(document).height()  -  ($(window).height()  +  $(window).scrollTop());
        if  (jia_scroll < 100 && flagData){
            load_more( postData );
        }
    }

    $listParent.scroll(function(){
        var v = $list.height() - $listParent.height() - $listParent.scrollTop();
        if(v < 10)
        {
            load_more({page:page,pos:"cardListMore"});
        }
    });

</script>


